<template>
	<view class="main">	
			
			<view class="item">
				<view class="lable">
					充值账号
				</view>
				<view class="input">
					  {{formc.mobile}}
					  <image src="@/static/ico/lr.png" mode="aspectFit" class="icor"></image>
				</view>
				
			</view>
			
			<view class="item">
				<view class="lable">
					充值金额
				</view>
				<view class="input">
					<input
					   placeholder="请输入充值金额"
					   v-model="formc.money"
									border='false'
									type='text'
									placeholderStyle="color: #BBBBBB;font-size: 12px;"									
									color="#ffffff"
									
					 ></input>
					 <text>￥</text>
				</view>
			</view>
			
		
		<view class="btn">
			<u-button  size="small" :loading="loading" @click="toAdd" text="充值"></u-button>
		</view>
		
		<view class="tips">
			<view class="title">
				注意事项
			</view>
				<view class="infos">1、充值不支持信用卡充值</view>				
				<view class="infos">2、绑定的储蓄卡默认为充值账号</view>				
				<view class="infos">3、充值资金实时到账</view>				
				<view class="infos">4、充值年度限额遵循银行卡发卡行相关规定</view>
		</view>
	</view>
</template>

<script>
		import {mixin} from '@/Mixins/mixin.js'
	export default {
		mixins:[mixin],
		data() {
			return {				
				formc:{
					paytype:'money',
					money:'',					
					mobile:''
				},
				type:1,
				loading:false
			}
		},
		onLoad(e){
			this.type=e.type
			let user=uni.getStorageSync('userInfo')
			this.formc.mobile=user.mobile
		},
		methods: {
		async toAdd(){		
				if(!this.formc.mobile){
					this.$u.toast('您未登录')
					return
				}
				if(this.formc.money<1){
					this.$u.toast('请输入充值金额最小值1')
					return
				}
				this.loading=true
				let res = await this.$http({
					url:this.$api.MoneyRecharge,
					method: 'POST',
					hideLoading: true,
					needToken:true,
					data:this.formc
				})
				this.loading=false
				if(res.code==200){
					this.topay(res.data.ordersn,this.formc.paytype)
					// uni.redirectTo({
					// 	url:'/pages/wallet/withdraw'
					// })
				}
				
			
			},
		}
	}
</script>

<style lang="scss" scoped>
.main{
	height: 100%;
	overflow: hidden;
	padding:0 32rpx;
	.tips{
		margin-top: 40rpx;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
		line-height: 34rpx;
		.infos{
			color: #999999;
			margin: 10rpx 0;
		}
	}
	.item{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 34rpx 0;
		border-bottom: 1px solid #f8f8f8;
		.lable{
			font-size: 28rpx;
			font-weight: 600;
			color: #333333;
			line-height: 40rpx;
			width: 160rpx;
		}
		.input{
			flex: 1;
			margin-left: 6rpx;
			color: #333333;
			font-size: 26rpx;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			input{
				    text-align: right;
					padding-right:10rpx ;
			}
		}
		.icor{
			height: 22rpx;
			width: 22rpx;
		}
	}
	.btn{
		margin: 156rpx auto 50rpx
		::v-deep button{
			color: #ffffff;
			background:#000000;
			border: 0;			
			font-weight: 600;
			font-size:30rpx ;
			height: 82rpx;
			border-radius: 9rpx;
			&.u-button--disabled{
				opacity: 1;
				color: #979797;				
				background: #252525;
			}
		}
	}
}
</style>
